package com.example.makerspace.controller.competition;

import com.example.makerspace.domain.CompetitionParentDO;
import com.example.makerspace.dto.PageRequest;
import com.example.makerspace.dto.Result;
import com.example.makerspace.dto.competition.CompetitionParentDTO;
import com.example.makerspace.dto.maker.AreaBaseDTO;
import com.example.makerspace.service.AreaService;
import com.example.makerspace.service.CompetitionParentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
@ResponseBody
@RequestMapping("/api/competitionParent")
@Api(tags = "报名活动模块")
public class CompetitionPartentController {

    @Autowired
    private CompetitionParentService competitionParentService;
    @ApiOperation(value="创建活动接口",notes ="创建活动接口说明")
    @PostMapping("/create")
    public Result create(@ModelAttribute CompetitionParentDTO competitionParentDTO) {
        return competitionParentService.create(competitionParentDTO);
    }
    @ApiOperation(value="查询活动接口",notes ="查询活动接口说明")
    @PostMapping("/query")
    public Result query(@RequestBody CompetitionParentDTO competitionParentDTO) {
        return competitionParentService.query(competitionParentDTO);
    }
    @ApiOperation(value="删除活动接口",notes ="删除活动接口说明")
    @PostMapping("/delete")
    public Result delete(@RequestBody CompetitionParentDTO competitionParentDTO) {
        return competitionParentService.delete(competitionParentDTO.getId());
    }
    @ApiOperation(value="更新活动接口",notes ="更新活动接口说明")
    @PostMapping("/update")
    public Result update(@ModelAttribute CompetitionParentDTO competitionParentDTO) {
        return competitionParentService.update(competitionParentDTO);
    }
    @ApiOperation(value="通过活动id查询接口",notes ="通过活动id查询接口说明")
    @GetMapping("/queryById")
    public Result queryById(@RequestParam("id") Integer id) {
        return competitionParentService.queryById(id);
    }
}
